********************************************************
***Analyses for "Congenial Messages from Politicians"***
********************************************************
***Written for STATA 17 ********************************
********************************************************

****************************************
***Setting up formats***
****************************************

*Necessary packages (Install, if not already installed)
	*ssc install coefplot
	*ssc install blindschemes 
	*net install grc1leg, from(http://www.stata.com/users/vwiggins/)
	
set scheme plotplain  
graph set window fontface "Garamond"

**************************************
***Recoding and labelling variables***
**************************************

*Variable used for analyses of attrition in experiment
	gen eksperiment_start=0
	recode eksperiment_start (0=1) if q14_norms_5_resp!=. //This variable is used later to check for attrition in experiment

*Left-Right (0-1, higher values denotes more right-leaning).
	recode q1_ideologi_1_resp (12=.) // don't know --> missing.
	gen LR=(q1_ideologi_1_resp-1)/10 // recoding, range: 0-1.
	sum LR, detail // median is 0.5
	gen LR_fold=abs(0.5-LR) // Folding the variable to create measure for ideological extremity (Higher values denotes more extreme).

*Left-Right subscales 
	recode 	q2_holdninger_1_resp q2_holdninger_2_resp q2_holdninger_3_resp q2_holdninger_4_resp q2_holdninger_5_resp q2_holdninger_6_resp (6=.) // don't know recoded as missing.

	*Left-Right Econ (0-1, higher values denotes more right-leaning).
	alpha  	q2_holdninger_1_resp q2_holdninger_2_resp q2_holdninger_3_resp, item gen(uns_LR_econ)
	tab uns_LR_econ
	gen LR_econ=1-((uns_LR_econ+5)/10) // Rescale to 0-1 and reverse 
	tab LR_econ
	sum LR_econ, detail //median value is 0.4
	gen	LR_econ_fold=abs(0.4-LR_econ) // *Folding the variable to create measure for ideological extremity on economy 
	tab LR_econ_fold

	*Left-Right Immigration (0-1, higher values denotes more right-leaning).
	alpha q2_holdninger_4_resp q2_holdninger_5_resp q2_holdninger_6_resp, item gen(uns_LR_immi)
	tab uns_LR_immi
	gen LR_immi=1-((uns_LR_immi+5)/10) // Reskale to 0-1 and reverse
	tab LR_immi
	sum LR_immi, detail // Median is 0.433
	gen	LR_immi_fold=abs(0.4333333-LR_immi) // // *Folding the variable to create measure for ideological extremity on immigration 
	tab LR_immi_fold
	
	
*Political Trust (don't know recoded as missing; range is 0-1,  higher values denote higher political trust).
	recode q7_pol_tillid_new_1_resp (12=.)
	gen pol_trust=(q7_pol_tillid_new_1_resp-1)/10 
	tab pol_trust
	
*Indeks: Stereotypes
	recode	q12_traits_1_resp q12_traits_2_resp q12_traits_3_resp q12_traits_4_resp q12_traits_5_resp q12_traits_6_resp (6=.)
	alpha 	q12_traits_1_resp q12_traits_2_resp q12_traits_3_resp q12_traits_4_resp q12_traits_5_resp q12_traits_6_resp, item gen(uns_pretreat_traits)
	tab uns_pretreat_traits
	gen pretreat_traits=(1-(uns_pretreat_traits+3)/8) // 
	tab pretreat_traits
	
*Indeks: Social Distancing
	recode 	q13_socialdist_1_resp q13_socialdist_2_resp q13_socialdist_3_resp q13_socialdist_4_resp (1=5) (2=4) (3=3) (4=2) (5=1) (6=.)
	alpha  	q13_socialdist_1_resp q13_socialdist_2_resp q13_socialdist_3_resp q13_socialdist_4_resp, item gen(uns_pretreat_social_dist)
	gen 	pretreat_social_dist=(uns_pretreat_social_dist-1)/4 
	tab 	pretreat_social_dist
	
*Indeks: Democratic norms
	recode	q14_norms_1_resp q14_norms_2_resp q14_norms_3_resp q14_norms_4_resp q14_norms_5_resp (6=.)
	recode q14_norms_2_resp (1=5) (2=4) (3=3) (4=2) (5=1)
	alpha	q14_norms_1_resp q14_norms_2_resp q14_norms_3_resp q14_norms_4_resp q14_norms_5_resp, item gen(uns_pretreat_dem_norm)
	tab uns_pretreat_dem_norm
	gen		pretreat_dem_norm=(uns_pretreat_dem_norm-1)/4 //
	tab pretreat_dem_norm

	
*******************************
***ANALYSES********************
*******************************	


*Descriptives 
 tab surveystatus
 tab q4_partivalg_ft if surveystatus==2 & q4_partivalg_ft<17
 
*Party characteristics 
	reg LR_econ i.q4_partivalg_ft
	margins i.q4_partivalg_ft, pwcompare(groups) // Confirms that Red-Green and Liberal Alliance are "ekstremes" on economic left-right scale

	reg LR_immi i.q4_partivalg_ft
	margins i.q4_partivalg_ft, pwcompare(groups) // Confirms that Danish Peoples Party and Social Liberals are "extremes" on immigration (Free Greens and Red-Green are insignificantly further to the left than Social Liberals)

	
****************
***EXPERIMENT***	
****************	

***Dependent variables : 

	*Emotions
	recode 	q17_emotions_1_resp q17_emotions_2_resp q17_emotions_3_resp q17_emotions_4_resp q17_emotions_5_resp q17_emotions_6_resp (6=.)
	alpha 	q17_emotions_1_resp q17_emotions_2_resp q17_emotions_3_resp q17_emotions_4_resp q17_emotions_5_resp q17_emotions_6_resp, item gen(uns_emotions_prereg) // high alpha, but surprising that sympathy correlates positively
	*alpha 	q17_emotions_1_resp q17_emotions_2_resp q17_emotions_3_resp q17_emotions_4_resp q17_emotions_5_resp q17_emotions_6_resp, reverse(q17_emotions_1_resp) item // When reversed, sympathy lowers reliability a lot
	tab uns_emotions // 23% express no feelings at all (uns_emotions=5). This explains positive correlation between sympathy and the other (negative) emotions
	gen emotions_prereg=1-((uns_emotions_prereg-1)/4) 
	drop 	uns_emotions_prereg
	factor  q17_emotions_1_resp q17_emotions_2_resp q17_emotions_3_resp q17_emotions_4_resp q17_emotions_5_resp q17_emotions_6_resp
	rotate, oblimin // Sympathy and pity load more strongly on another factor. Higher alpha by leaving them out:
	alpha 	q17_emotions_2_resp q17_emotions_3_resp q17_emotions_4_resp q17_emotions_5_resp q17_emotions_6_resp  , item gen(uns_emotions) //
	gen 	emotions=1-((uns_emotions-1)/4) // Rescale and reverse so that high value denotes strong negative feelings
	tab 	emotions
	drop 	uns_emotions

	*Social distancing
	recode 	q18_norms_socialdist_5_resp q18_norms_socialdist_6_resp (6=.)
	alpha 	q18_norms_socialdist_5_resp q18_norms_socialdist_6_resp, item gen(uns_social_dist) 
	gen 	social_dist=(1-(uns_social_dist-1)/4) // Rescale and reverse so that high value denotes high desire for social distancing
	tab 	social_dist
	drop 	uns_social_dist

	*Democratic norms
	recode 	q18_norms_socialdist_1_resp q18_norms_socialdist_2_resp q18_norms_socialdist_3_resp q18_norms_socialdist_4_resp (6=.)
	alpha 	q18_norms_socialdist_1_resp q18_norms_socialdist_2_resp q18_norms_socialdist_3_resp q18_norms_socialdist_4_resp, item gen(uns_dem_norm) 
	gen 	dem_norm=(uns_dem_norm-1)/4 // Rescale
	tab 	dem_norm
	drop uns_dem_norm

***Treatment 
	recode 	eksperiment (7=0) (1=1) (2=2) (3=1) (4=2) (5=2) (6=1), gen(eksperiment_blok) // 0 = control, 1 = treatment with quote from left-block politician, and 2 = treatment with quote from right-block politician. 
	label 	define red_blue 0 "Control" 1 "Red Block" 2 "Blue Block"
	label 	values eksperiment_blok red_blue
	recode 	eksperiment_blok (2=1), gen(eksperiment_all) // 0 = control og 1 = any treatment
	label 	define eksperiment_all 0 "Control" 1 "Treatment"
	label 	values eksperiment_all eksperiment_all  

*Respondent political block (1 = left, 2 = right).
	// Variable is based on who respondent would vote for in parliamentary election. 
	// If not voting for named party, respondent placed in block based on Left-Right self placement 
	// Respondent answering "don't know or choosing middle placement on Left-Right scale are coded as missing 
	gen 	resp_blok=. 
	replace	resp_blok =1 if q4_partivalg_ft==1 | q4_partivalg_ft==2 | q4_partivalg_ft==5 | q4_partivalg_ft==6 | q4_partivalg_ft==10 | q4_partivalg_ft==12 | q4_partivalg_ft==13 
	replace resp_blok =2 if q4_partivalg_ft==3 | q4_partivalg_ft==4 | q4_partivalg_ft==7 | q4_partivalg_ft==8 | q4_partivalg_ft==9 | q4_partivalg_ft==11 | q4_partivalg_ft==14
	replace resp_blok =2 if LR>.6 & LR<1.1 & resp_blok==.
	replace resp_blok =1 if LR<.41 & resp_blok==.
	label 	values resp_blok red_blue
	
*Ingroup or outgroup (control=0; Outgroup=1 Ingroup=2).
	gen 	group_treat=.
	replace	group_treat =0 if eksperiment_blok==0
	replace	group_treat =1 if eksperiment_blok==1 & resp_blok ==2
	replace	group_treat =1 if eksperiment_blok==2 & resp_blok ==1
	replace	group_treat =2 if eksperiment_blok==1 & resp_blok ==1
	replace	group_treat =2 if eksperiment_blok==2 & resp_blok ==2	
	label 	define ingroup 0 "Control" 1 "Outgroup treatment" 2 "Ingroup treatment"
	label 	values group_treat ingroup
	tab group_treat
	
**Exploratory: Ingroup or outgroup PARTY (control=0; Outgroup=1 Ingroup=2).	
	gen party_treat=1
	replace party_treat =2 if eksperiment==1 & q4_partivalg_ft==1
	replace party_treat =2 if eksperiment==2 & q4_partivalg_ft==11
	replace party_treat =2 if eksperiment==3 & q4_partivalg_ft==2
	replace party_treat =2 if eksperiment==4 & q4_partivalg_ft==9
	replace party_treat =2 if eksperiment==5 & q4_partivalg_ft==7
	replace party_treat =2 if eksperiment==6 & q4_partivalg_ft==12
	replace party_treat =0 if eksperiment==7
	tab party_treat


***Attrition after exposure to experimental treatment
	tab eksperiment_blok surveystatus if eksperiment_start==1, row chi // 2056 started experiment, 22 attrited

*Main effect (Hypothesis 1)
	*reg emotions i.eksperiment_all 
	reg emotions i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		eststo exp_emotions
		margins, at(eksperiment_all=0) post
		eststo exp_emotions_coef0
		estimates restore exp_emotions
		margins, at(eksperiment_all=1) post
		eststo exp_emotions_coef1
		*Effect size
		sum emotions 
		gen emotions_sd =r(sd)
		reg emotions eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		display _b[eksperiment_all] /emotions_sd
		drop emotions_sd  
	
	*reg social_dist i.eksperiment_all   
	reg social_dist i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		eststo exp_social_dist
		margins, at(eksperiment_all=0) post
		eststo exp_social_dist_coef0
		estimates restore exp_social_dist
		margins, at(eksperiment_all=1) post
		eststo exp_social_dist_coef1
		*Effect size
		sum social_dist 
		gen social_dist_sd =r(sd)
		reg social_dist eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		display _b[eksperiment_all] /social_dist_sd
		drop social_dist_sd 
	
	*reg dem_norm i.eksperiment_all
	reg dem_norm i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm 
		eststo exp_dem_norm
		margins, at(eksperiment_all=0) post
		eststo exp_dem_norm_coef0
		estimates restore exp_dem_norm
		margins, at(eksperiment_all=1) post
		eststo exp_dem_norm_coef1	
		*Effect size
		sum dem_norm 
		gen dem_norm_sd =r(sd)
		reg dem_norm eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		display _b[eksperiment_all] /dem_norm_sd
		drop dem_norm_sd 
		
		
	coefplot 	(exp_emotions_coef0, mcolor(white)) (exp_emotions_coef1, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) mlabel mlabformat(%9.2g) mlabposition(2) xscale(off) ylabel(.2(.02).30)  ///
				title("Negative Emotions") plotlabels("Control" "Treated") legend(rows(1))
					graph save exp_følelser.gph, replace		
	coefplot 	(exp_social_dist_coef0, mcolor(white)) (exp_social_dist_coef1, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) mlabel mlabformat(%9.2g) mlabposition(2) xscale(off) ylabel(.15(.02).25)   ///
				title("Social Distancing") 
					graph save exp_social_dist.gph, replace
	coefplot 	(exp_dem_norm_coef0, mcolor(white)) (exp_dem_norm_coef1, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) mlabel mlabformat(%9.2g) mlabposition(2) xscale(off)  ylabel(.9(.02)1)  ///
				title("Democratic Norms") plotlabels("Control" "Treated") legend(rows(1) position(6))
					graph save demo_norm.gph, replace				
	grc1leg2 	exp_følelser.gph exp_social_dist.gph, col(2) imargin(0 0 0 0) 			
				graph export figure_1.jpg, quality(90) width(1800) replace
					erase exp_følelser.gph
					erase exp_social_dist.gph
					erase demo_norm.gph	
					
*Ingroup/outgroup (Hypothesis 2)

	*reg emotions i.group_treat   
	reg emotions i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if resp_blok !=.
		eststo exp_emotions_ingroup
		margins i.group_treat, pwcompare(effects)
		estimates restore exp_emotions_ingroup
		margins, at(group_treat=0) post
		eststo exp_emotions_ingroup_coef0
		estimates restore exp_emotions_ingroup
		margins, at(group_treat=1) post
		eststo exp_emotions_ingroup_coef1
		estimates restore exp_emotions_ingroup
		margins, at(group_treat=2) post
		eststo exp_emotions_ingroup_coef2
	
	*reg social_dist i.group_treat 
	reg social_dist i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if resp_blok !=.
		eststo exp_social_dist_ingroup
		margins i.group_treat, pwcompare(effects) 
		estimates restore exp_social_dist_ingroup
		margins, at(group_treat=0) post
		eststo social_dist_ingroup_coef0
		estimates restore exp_social_dist_ingroup
		margins, at(group_treat=1) post
		eststo social_dist_ingroup_coef1
		estimates restore exp_social_dist_ingroup
		margins, at(group_treat=2) post
		eststo social_dist_ingroup_coef2
		
	*reg dem_norm i.group_treat
	reg dem_norm i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if resp_blok !=.
	eststo exp_dem_norm_ingroup
		margins i.group_treat, pwcompare(effects) 
		estimates restore exp_dem_norm_ingroup
		margins, at(group_treat=0) post
		eststo dem_norm_ingroup_coef0
		estimates restore exp_dem_norm_ingroup
		margins, at(group_treat=1) post
		eststo dem_norm_ingroup_coef1
		estimates restore exp_dem_norm_ingroup
		margins, at(group_treat=2) post
		eststo dem_norm_ingroup_coef2


	coefplot 	(exp_emotions_ingroup_coef0, mcolor(white)) (exp_emotions_ingroup_coef1, mcolor(gs12)) (exp_emotions_ingroup_coef2, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) mlabel mlabformat(%9.2g) mlabposition(2) xscale(off) ylabel(.2(.02).30) ///
				title("Negative Emotions") plotlabels("Control" "Outgroup treatment" "Ingroup treatment") legend(rows(1))
					graph save exp_følelser_ingroup.gph, replace		
	coefplot 	(social_dist_ingroup_coef0, mcolor(white)) (social_dist_ingroup_coef1, mcolor(gs12)) (social_dist_ingroup_coef2, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) mlabel mlabformat(%9.2g) mlabposition(2) xscale(off) ylabel(.15(.02).25)   ///
				title("Social Distancing") 
					graph save exp_social_dist_ingroup.gph, replace
	coefplot 	(dem_norm_ingroup_coef0, mcolor(white) msymbol(circle)) (dem_norm_ingroup_coef1, mcolor(12))  (dem_norm_ingroup_coef2, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) mlabel mlabformat(%9.2g) mlabposition(2) xscale(off) ylabel(.9(.02)1)  ///
				title("Democratic Norms") plotlabels("Control" `" "Outgroup" "treatment" "' `" "Ingroup" "treatment" "')  legend(rows(1) position(6))
					graph save demo_norm_ingroup.gph, replace				
	grc1leg2 	exp_følelser_ingroup.gph exp_social_dist_ingroup.gph, col(2) imargin(0 0 0 0)		
				graph export figure_2.jpg, quality(90) width(1800) replace	
					erase exp_følelser_ingroup.gph
					erase exp_social_dist_ingroup.gph
					erase demo_norm_ingroup.gph
		
* Political Trust (Hypothesis 3)
	sum c.pol_trust if emotions!=. & eksperiment_all!=. & pretreat_traits!=. & pretreat_social_dist!=. & pretreat_dem_norm!=., detail 
		
	*reg emotions i.eksperiment_all##c.pol_trust 
	reg emotions i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm
		eststo exp_emotions_trust
		margins, at(eksperiment_all=(0) pol_trust=(0 (.2) 1) ) post
		eststo emotions_trust_control
		estimates restore exp_emotions_trust
		margins, at(eksperiment_all=1 pol_trust=(0 (.2) 1) ) post
		eststo emotions_trust_treat
		coefplot (emotions_trust_control, mcolor(white)) (emotions_trust_treat, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) ylabel(.2(.02).30) ///
				title("Negative Emotions") plotlabels("Control" "Treated") coeflabel(1._at="0" 2._at= ".2" 3._at=".4" 4._at= ".6" 5._at=".8" 6._at= "1")  legend(rows(1))
				graph save exp_emotions_trust.gph, replace
		
	*reg social_dist i.eksperiment_all##c.pol_trust   
	reg social_dist i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm
		eststo exp_social_dist_trust
		margins, at(eksperiment_all=(0) pol_trust=(0 (.2) 1) ) post
		eststo social_dist_trust_control
		estimates restore exp_social_dist_trust
		margins, at(eksperiment_all=1 pol_trust=(0 (.2) 1) ) post
		eststo social_dist_trust_treat
		coefplot (social_dist_trust_control, mcolor(white)) (social_dist_trust_treat, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) ylabel(.10(.03).30) ///
				title("Social Distancing") plotlabels("Control" "Treated") coeflabel(1._at="0" 2._at= ".2" 3._at=".4" 4._at= ".6" 5._at=".8" 6._at= "1") legend(rows(1))
				graph save exp_social_dist_trust.gph, replace
		
	*reg dem_norm i.eksperiment_all##c.pol_trust
	reg dem_norm i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm
		eststo exp_dem_norm_trust
		margins, at(eksperiment_all=(0) pol_trust=(0 (.2) 1) ) post
		eststo demnorm_control
		estimates restore exp_dem_norm_trust
		margins, at(eksperiment_all=1 pol_trust=(0 (.2) 1) ) post
		eststo demnorm_treat
		coefplot (demnorm_control, mcolor(white)) (demnorm_treat, mcolor(gs6)), ///
				vertical fintensity(100) ciopts(color(black)) msymbol(circle) msize(vlarge) mlcolor(black) ylabel(.9(.02)1) ///
				title("Democratic Norms") plotlabels("Control" "Treated") coeflabel(1._at="0" 2._at= ".2" 3._at=".4" 4._at= ".6" 5._at=".8" 6._at= "1") legend(rows(1) position(6))
				graph save demo_norm_trust.gph, replace
		
		
	*Combined graph
	grc1leg2 	exp_emotions_trust.gph exp_social_dist_trust.gph, col(2) imargin(0 0 0 0)			
				graph export figure_3.jpg, quality(90) width(1800) replace	
					erase exp_emotions_trust.gph 
					erase exp_social_dist_trust.gph
					erase demo_norm_trust.gph

				
***Attention check
	tab eksperiment q18_att_check, nol row
	gen correct_recall=.
	recode correct_recall (.=0) if eksperiment!=q18_att_check & q18_att_check!=.
	recode correct_recall (.=1) if eksperiment==q18_att_check & q18_att_check!=.
	tab correct_recall // ok recall

*Preregistered measure of emotions:	
	reg emotions_prereg i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm // H1 same conclusion
	reg emotions_prereg i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm
	margins i.group_treat, pwcompare(effects) // H2 same conclusion
	reg emotions_prereg i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm // H3 same conclusion	
	
**************************				
***Exploratory Analyses***		
**************************		

recode eksperiment (7=0)
reg emotions i.eksperiment pretreat_traits pretreat_social_dist pretreat_dem_norm 
	margins i.eksperiment, pwcompare(effects) 
reg social_dist i.eksperiment pretreat_traits pretreat_social_dist pretreat_dem_norm 
	margins i.eksperiment, pwcompare(effects) 
reg dem_norm i.eksperiment pretreat_traits pretreat_social_dist pretreat_dem_norm 
	margins i.eksperiment, pwcompare(effects) 
	
	
*Respondents' Surprise
	recode q16 (6=.) (5=0) (4=.25) (3=.50) (2=.75) (1=1) , gen(surprise)
	reg surprise i.eksperiment 
	reg surprise i.group_treat
	reg emotions  surprise
	reg emotions i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if group_treat!=0 
	eststo surprise1
	reg emotions i.group_treat surprise pretreat_traits pretreat_social_dist pretreat_dem_norm if group_treat!=0
	eststo surprise2
	esttab , label se b(%8,2f) r2
	
*Are effects moderated by pre-treatment levels of polarization?
	
	egen float pretreat_traits_3 = cut(pretreat_traits), group(3)
	gen float pretreat_social_dist_3 = . // "cut" does not function properly with pretreat_social_dist because of large share of 0
		recode pretreat_social_dist_3 (.=0) if pretreat_social_dist==0
		recode pretreat_social_dist_3 (.=1) if pretreat_social_dist>0 & pretreat_social_dist<0.35 
		recode pretreat_social_dist_3 (.=2) if pretreat_social_dist>=0.35
	egen float pretreat_dem_norm_3 = cut(pretreat_dem_norm), group(3)
	
	reg emotions i.eksperiment_all##i.pretreat_traits_3 i.pretreat_traits_3 i.pretreat_social_dist_3 i.pretreat_dem_norm_3 
		eststo emo_trait
		margins, dydx(eksperiment_all) at(pretreat_traits_3=(0 1 2)) post
		eststo emo_trait_margin
	reg emotions i.eksperiment_all##i.pretreat_social_dist_3 i.pretreat_traits_3 i.pretreat_social_dist_3 i.pretreat_dem_norm_3
		eststo emo_sd
		margins, dydx(eksperiment_all) at(pretreat_social_dist_3=(0 1 2)) post
		eststo emo_sd_margin
		
	reg social_dist i.eksperiment_all##i.pretreat_traits_3 i.pretreat_traits_3 i.pretreat_social_dist_3 i.pretreat_dem_norm_3 
		eststo sd_trait
		margins, dydx(eksperiment_all) at(pretreat_traits_3=(0 1 2)) pwcompare(groups) post
		eststo sd_trait_margin
	reg social_dist i.eksperiment_all##i.pretreat_social_dist_3 i.pretreat_traits_3 i.pretreat_social_dist_3 i.pretreat_dem_norm_3 
		eststo sd_sd
		margins, dydx(eksperiment_all) at(pretreat_social_dist_3=(0 1 2)) 
		eststo sd_sd_margin
					
	
***Results without participants failing the attention check***
***Note: We include these analyses as a reply to reviewer comments. We do not believe that these analyses provide usefull estimates, as they condition on a post-treatment variable!
	tab correct_recall, mis
	reg emotions i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		reg emotions i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | eksperiment_all==0 //no difference
	reg social_dist i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		reg social_dist i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | eksperiment_all==0 // effect becomes marginally significant (p=.073 instead of p=0.035)
	reg dem_norm i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm
		reg dem_norm i.eksperiment_all pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | eksperiment_all==0 //no difference
	
	reg emotions i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm
	margins i.group_treat, pwcompare(effects)
		reg emotions i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | group_treat==0 
		margins i.group_treat, pwcompare(effects) //no substantial difference
	reg social_dist i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm
	margins i.group_treat, pwcompare(effects)
		reg social_dist i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | group_treat==0
		margins i.group_treat, pwcompare(effects) //no substantial difference
	reg dem_norm i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm
	margins i.group_treat, pwcompare(effects) 
		reg dem_norm i.group_treat pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | group_treat==0
		margins i.group_treat, pwcompare(effects) //no substantial difference
			
	reg emotions i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm
		reg emotions i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | eksperiment_all==0 //no difference
	reg social_dist i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm
		reg social_dist i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | eksperiment_all==0 //interaction becomes marginally significant (p=0.054 instead of 0.027)
	reg dem_norm i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm
		reg dem_norm i.eksperiment_all##c.pol_trust pretreat_traits pretreat_social_dist pretreat_dem_norm if correct_recall==1 | eksperiment_all==0 //no difference
	
	
***Partysympathy and block	
foreach var of varlist q10_fav_parti_1_resp q10_fav_parti_2_resp q10_fav_parti_3_resp q10_fav_parti_4_resp q10_fav_parti_5_resp q10_fav_parti_6_resp q10_fav_parti_7_resp q10_fav_parti_8_resp q10_fav_parti_9_resp q10_fav_parti_10_resp q10_fav_parti_11_resp q10_fav_parti_12_resp q10_fav_parti_13_resp {
	reg  `var'  i.resp_blok	
		margins i.resp_blok, post
	eststo `var'block
	}
		
	coefplot q10_fav_parti_1_respblock, bylabel(Socialdemokratiet) || q10_fav_parti_2_respblock, bylabel(Radikale)  || q10_fav_parti_3_respblock, bylabel(Konservative)  || q10_fav_parti_4_respblock, bylabel(NB)  ///
	|| q10_fav_parti_5_respblock, bylabel(SF) || q10_fav_parti_6_respblock, bylabel("Liberal A") || q10_fav_parti_7_respblock, bylabel(Kristendemokraterne)  || q10_fav_parti_8_respblock, bylabel(Moderaterne) ///
	|| q10_fav_parti_9_respblock, bylabel(DF) 	|| q10_fav_parti_10_respblock, bylabel(Ventre)  || q10_fav_parti_11_respblock, bylabel(Enhedslisten)  || q10_fav_parti_12_respblock, bylabel(Alternativet)  ///
	|| q10_fav_parti_13_respblock, bylabel("Frie Grønne")
	
	coefplot 	q10_fav_parti_1_respblock, bylabel("Social Democrats") || ///
				q10_fav_parti_11_respblock, bylabel("The Red-Green Alliance") || ///   
				q10_fav_parti_2_respblock, bylabel("Social Liberals")  || ///
				q10_fav_parti_10_respblock, bylabel("The Liberals")  || ///
				q10_fav_parti_6_respblock, bylabel("Liberal Alliance") ||  ///
				q10_fav_parti_9_respblock, bylabel("Danish Peoples' Party") 
				graph export figure_a1.jpg, quality(90) width(1800) replace	
					

*************************
***Tables for appendix***	
*************************	

#delimit ;
global regtab_exp 	", se b(%8,2f) r2 wide label replace
					refcat(0.eksperiment_all "{\i Experimental Treatments }" 0.group_treat "{\i Experimental Treatments}" pretreat_traits "{\i Covariates}", nolabel)  
					coeflabel(pretreat_traits "Stereotypes (pre-treatment)" pretreat_social_dist "Social distancing (pre-treatment)" pretreat_dem_norm "Democratic norms (Pre-treatment)" _cons "Constant" pol_trust "Political Trust")" ;
#delimit cr
esttab  	exp_emotions exp_social_dist exp_dem_norm using exp_main.rtf $regtab_exp 
esttab  	exp_emotions_ingroup exp_social_dist_ingroup  exp_dem_norm_ingroup using exp_ingroup.rtf $regtab_exp
esttab		exp_emotions_trust exp_social_dist_trust exp_dem_norm_trust using exp_trust.rtf $regtab_exp
esttab  	emo_trait sd_trait emo_sd  sd_sd using pre_pol.rtf , se b(%8,2f) r2 wide label replace ///
			refcat(		0.eksperiment_all "{\i Experimental Treatments}" 0.pretreat_traits_3 "{\i Pre-treatment polarization: perceived traits}" /// 
						0.pretreat_social_dist_3 "{\i Pre-treatment polarization: Social distancing}" 0.pretreat_dem_norm_3 "{\i Pre-treatment democratic norms}" , nolabel)  ///
			coeflabel(	0.pretreat_traits_3 "Low" 1.pretreat_traits_3 "Moderate" 2.pretreat_traits_3 "High"  ///
						1.eksperiment_all#0.pretreat_traits_3 "Treatment x Low" ///
						1.eksperiment_all#1.pretreat_traits_3 "Treatment x Moderate" ///
						1.eksperiment_all#2.pretreat_traits_3 "Treatment x High" ///
						0.pretreat_social_dist_3 "Low" 1.pretreat_social_dist_3 "Moderate" 2.pretreat_social_dist_3 "High" ///
						1.eksperiment_all#0.pretreat_social_dist_3 "Treatment x Low" ///
						1.eksperiment_all#1.pretreat_social_dist_3 "Treatment x Moderate" ///
						1.eksperiment_all#2.pretreat_social_dist_3 "Treatment x High" ///						
						0.pretreat_dem_norm_3 "Low" 1.pretreat_dem_norm_3 "Moderate" 2.pretreat_dem_norm_3 "High" ///
						_cons "Constant") ///
						order(	0.eksperiment_all 1.eksperiment_all  0.pretreat_traits_3 1.pretreat_traits_3 2.pretreat_traits_3 ///
								1.eksperiment_all#0.pretreat_traits_3 1.eksperiment_all#1.pretreat_traits_3 1.eksperiment_all#2.pretreat_traits_3 ///
								0.pretreat_social_dist_3 1.pretreat_social_dist_3 2.pretreat_social_dist_3 /// 
								1.eksperiment_all#0.pretreat_social_dist_3 1.eksperiment_all#1.pretreat_social_dist_3 1.eksperiment_all#2.pretreat_social_dist_3 ///						
								0.pretreat_dem_norm_3 1.pretreat_dem_norm_3 2.pretreat_dem_norm_3 ///
								_cons "Constant") ///
			drop(0.eksperiment_all#*) 
			
	
*********************
***THE END***********
*********************